#! /usr/bin/env node

// console.log(process.argv);

let argv = process.argv.slice(2);

let {version} = require('./package.json');

let app = require('./server/app');

console.log(version);

if(argv[0] === '-v' || argv[0] === '--version'){
    console.log(`版本号:${version}`)
}else{
    //起服务
    let port = (argv[0] === '-p' && argv[1]) ? argv[1] : 8080;
    app.listen(port,() => {
        console.log(`服务启动成功${port}`)
    })
}